(define (same-parity . items)
  (define (parity-filter p items)
    (if (null? items)
      '()
      (let ((head (car items))
            (tail (cdr items)))
        (if (p head)
          (cons head (parity-filter p tail))
          (parity-filter p tail)))))
  (if (null? items)
    (error "列表不可为空.")
    (parity-filter (if (even? (car items))
                     even?
                     odd?)
                   (cdr items))))

(same-parity)
(same-parity 1 2 3 4 5 6)
(same-parity 12 2 3 4 5 6 7 8)
